﻿<Application x:Class="TorchView.Shell.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Startup="Application_Startup">
  <Application.Resources>

    <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#FF314159" />

    <SolidColorBrush x:Key="HighlightedTextBrush" Color="White" />
    <SolidColorBrush x:Key="UnhighlightedTextBrush" Color="#AEAEAE" />
    <SolidColorBrush x:Key="BackgroundBrush" Color="#3A3A3A" />
    <SolidColorBrush x:Key="BorderBrush" Color="#4D4B48" />

    <SolidColorBrush x:Key="DisabledForegroundBrush" Color="LightGray" />

    <LinearGradientBrush x:Key="BackgroundGradient" StartPoint="0,0" EndPoint="0,1">
      <GradientStop Color="#5A5A5A" Offset="0" />
      <GradientStop Color="#3A3A3A" Offset="1" />
    </LinearGradientBrush>

    <Style TargetType="Run">
      <Setter Property="FontFamily" Value="Arial" />
      <Setter Property="FontSize" Value="12" />
    </Style>

    <Style TargetType="Hyperlink">
      <Setter Property="Foreground" Value="{StaticResource UnhighlightedTextBrush}" />
      <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="true">
          <Setter Property="Foreground" Value="{StaticResource HighlightedTextBrush}" />
        </Trigger>
      </Style.Triggers>
    </Style>

    <Style x:Key="DialogWindowStyle" TargetType="Window">
      <Setter Property="SizeToContent" Value="WidthAndHeight" />
      <Setter Property="ResizeMode" Value="NoResize" />
      <Setter Property="WindowStyle" Value="None" />
      <Setter Property="ShowInTaskbar" Value="False" />
      <Setter Property="Background" Value="{StaticResource BackgroundGradient}" />
      <Setter Property="Foreground" Value="{StaticResource HighlightedTextBrush}" />
      <Setter Property="AllowsTransparency" Value="True" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Window">
            <Border CornerRadius="3" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <ContentPresenter Grid.Row="1" />
                <TextBlock Text="{TemplateBinding Title}" FontWeight="Bold" Margin="7" />
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="2">
                  <StackPanel.Resources>
                    <Style TargetType="Button">
                      <Setter Property="Margin" Value="2" />
                      <Setter Property="Foreground" Value="{StaticResource UnhighlightedTextBrush}" />
                      <Setter Property="Template">
                        <Setter.Value>
                          <ControlTemplate TargetType="Button">
                            <Border Background="Transparent" Padding="2">
                              <ContentPresenter />
                            </Border>
                          </ControlTemplate>
                        </Setter.Value>
                      </Setter>
                      <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                          <Setter Property="Foreground" Value="{StaticResource HighlightedTextBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                          <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
                        </Trigger>
                      </Style.Triggers>
                    </Style>
                    <Style TargetType="Polyline">
                      <Setter Property="Stretch" Value="None" />
                      <Setter Property="Width" Value="10" />
                      <Setter Property="Height" Value="10" />
                      <Setter Property="StrokeThickness" Value="2" />
                      <Setter Property="Stroke" Value="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}" />
                    </Style>
                  </StackPanel.Resources>
                  <Button Command="{Binding CancelCommand}">
                    <Polyline Points="0,0 10,10 5,5 10,0 0,10" />
                  </Button>
                </StackPanel>
              </Grid>
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

    <Style TargetType="Button">
      <Setter Property="MinWidth" Value="72" />
      <Setter Property="MinHeight" Value="23" />
      <Setter Property="Padding" Value="4" />
      <Setter Property="Background" Value="{StaticResource BackgroundGradient}" />
      <Setter Property="Foreground" Value="{StaticResource HighlightedTextBrush}" />
      <Setter Property="BorderBrush" Value="{StaticResource UnhighlightedTextBrush}" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Button">
            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="4">
              <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
      <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="true">
          <Setter Property="BorderBrush" Value="{StaticResource HighlightedTextBrush}" />
        </Trigger>
      </Style.Triggers>
    </Style>

    <Style x:Key="DefaultTabItemStyle" TargetType="TabItem">
      <Setter Property="OverridesDefaultStyle" Value="true" />
      <Setter Property="Foreground" Value="{StaticResource UnhighlightedTextBrush}" />
      <Setter Property="MinHeight" Value="19" />
      <Setter Property="MinWidth" Value="100" />
      <Setter Property="HorizontalContentAlignment" Value="Stretch" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type TabItem}">
            <Grid Name="Border" Background="Transparent">
              <ContentPresenter VerticalAlignment="Center" ContentSource="Header" Margin="4,2" RecognizesAccessKey="True" />
            </Grid>
            <ControlTemplate.Triggers>
              <Trigger Property="IsSelected" Value="True">
                <Setter Property="Foreground" Value="{StaticResource HighlightedTextBrush}" />
                <Setter TargetName="Border" Property="Background" Value="{StaticResource SelectedBackgroundBrush}" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
      <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="true">
          <Setter Property="Foreground" Value="{StaticResource HighlightedTextBrush}" />
        </Trigger>
        <Trigger Property="IsEnabled" Value="false">
          <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
        </Trigger>
      </Style.Triggers>
    </Style>

    <Style x:Key="DefaultTabControlStyle" TargetType="TabControl">
      <Setter Property="ItemContainerStyle" Value="{StaticResource DefaultTabItemStyle}" />
      <Setter Property="TabStripPlacement" Value="Left" />
      <Setter Property="BorderThickness" Value="0" />
      <Setter Property="Background" Value="{x:Null}" />
      <Setter Property="Padding" Value="10,0,0,0" />
    </Style>
  </Application.Resources>
</Application>